import Vue from 'vue'
import Router from 'vue-router'

//引入组件
/* import login from '@/components/login'
import index from '@/components/index' */

//异步加载组件
const login = () => import('@/components/login')
const index = () => import('@/components/index')
const home = () => import('@/components/home')
const userList = () => import('@/components/userList')
const vipUser = () => import('@/components/vipUser')
const changePassword = () => import('@/components/changePassword')

Vue.use(Router)

export default new Router({
  mode: 'history', //去掉url中的#
  routes: [{
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/',
      name: 'index',
      component: index,
      redirect: "/login",
      children: [{
        path: '/home',
        name: 'home',
        component: home,
        
      }, {
        path: '/userList',
        name: 'userList',
        component: userList
      }, {
        path: '/vipUser',
        name: 'vipUser',
        component: vipUser
      }, {
        path: '/changePassword',
        name: 'changePassword',
        component: changePassword
      }, ]
    }
  ]
})
